import jsonschema

schema = {
    "type": "object",
    "properties": {
        "success": {"type": "boolean"},
        "code": {"type": "integer"},
        "message": {"type": "string"},
        "data": {"type": "object",
                 "properties": {
                     "name": {"type": "string"},
                     "age": {"type": "integer"},
                 }
        }

    }
}
data = {
    "success": True,
    "code": 10000,
    "message": "操作成功",
    "data": {
        "name": "tom",
        "age": 18
    }
}
res=jsonschema.validate(instance=data,schema=schema)
print(res)